/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ccore.expression.util;

import ccore.common.CNode;
import ccore.expression.*;

import java.util.List;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * The <b>Switch</b> for the model's inheritance hierarchy.
 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
 * to invoke the <code>caseXXX</code> method for each class of the model,
 * starting with the actual class of the object
 * and proceeding up the inheritance hierarchy
 * until a non-null result is returned,
 * which is the result of the switch.
 * <!-- end-user-doc -->
 * @see ccore.expression.ExpressionPackage
 * @generated
 */
public class ExpressionSwitch<T> {
	/**
	 * The cached model package
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected static ExpressionPackage modelPackage;

	/**
	 * Creates an instance of the switch.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ExpressionSwitch() {
		if (modelPackage == null) {
			modelPackage = ExpressionPackage.eINSTANCE;
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	public T doSwitch(EObject theEObject) {
		return doSwitch(theEObject.eClass(), theEObject);
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(EClass theEClass, EObject theEObject) {
		if (theEClass.eContainer() == modelPackage) {
			return doSwitch(theEClass.getClassifierID(), theEObject);
		}
		else {
			List<EClass> eSuperTypes = theEClass.getESuperTypes();
			return
				eSuperTypes.isEmpty() ?
					defaultCase(theEObject) :
					doSwitch(eSuperTypes.get(0), theEObject);
		}
	}

	/**
	 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @return the first non-null result returned by a <code>caseXXX</code> call.
	 * @generated
	 */
	protected T doSwitch(int classifierID, EObject theEObject) {
		switch (classifierID) {
			case ExpressionPackage.CINT_VAR: {
				CIntVar cIntVar = (CIntVar)theEObject;
				T result = caseCIntVar(cIntVar);
				if (result == null) result = caseCIntExprVar(cIntVar);
				if (result == null) result = caseCIntExpr(cIntVar);
				if (result == null) result = caseCNode(cIntVar);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CINT_EXPR: {
				CIntExpr cIntExpr = (CIntExpr)theEObject;
				T result = caseCIntExpr(cIntExpr);
				if (result == null) result = caseCNode(cIntExpr);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CINT_CST: {
				CIntCst cIntCst = (CIntCst)theEObject;
				T result = caseCIntCst(cIntCst);
				if (result == null) result = caseCIntExprCst(cIntCst);
				if (result == null) result = caseCIntExpr(cIntCst);
				if (result == null) result = caseCNode(cIntCst);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CINT_EXPR_CST: {
				CIntExprCst cIntExprCst = (CIntExprCst)theEObject;
				T result = caseCIntExprCst(cIntExprCst);
				if (result == null) result = caseCIntExpr(cIntExprCst);
				if (result == null) result = caseCNode(cIntExprCst);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CADD_CST: {
				CAddCst cAddCst = (CAddCst)theEObject;
				T result = caseCAddCst(cAddCst);
				if (result == null) result = caseCBasicIntExprCst(cAddCst);
				if (result == null) result = caseCIntExprCst(cAddCst);
				if (result == null) result = caseCIntExpr(cAddCst);
				if (result == null) result = caseCNode(cAddCst);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CSUB_CST: {
				CSubCst cSubCst = (CSubCst)theEObject;
				T result = caseCSubCst(cSubCst);
				if (result == null) result = caseCBasicIntExprCst(cSubCst);
				if (result == null) result = caseCIntExprCst(cSubCst);
				if (result == null) result = caseCIntExpr(cSubCst);
				if (result == null) result = caseCNode(cSubCst);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CMULT_CST: {
				CMultCst cMultCst = (CMultCst)theEObject;
				T result = caseCMultCst(cMultCst);
				if (result == null) result = caseCBasicIntExprCst(cMultCst);
				if (result == null) result = caseCIntExprCst(cMultCst);
				if (result == null) result = caseCIntExpr(cMultCst);
				if (result == null) result = caseCNode(cMultCst);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CDIV_CST: {
				CDivCst cDivCst = (CDivCst)theEObject;
				T result = caseCDivCst(cDivCst);
				if (result == null) result = caseCBasicIntExprCst(cDivCst);
				if (result == null) result = caseCIntExprCst(cDivCst);
				if (result == null) result = caseCIntExpr(cDivCst);
				if (result == null) result = caseCNode(cDivCst);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CBASIC_INT_EXPR_CST: {
				CBasicIntExprCst cBasicIntExprCst = (CBasicIntExprCst)theEObject;
				T result = caseCBasicIntExprCst(cBasicIntExprCst);
				if (result == null) result = caseCIntExprCst(cBasicIntExprCst);
				if (result == null) result = caseCIntExpr(cBasicIntExprCst);
				if (result == null) result = caseCNode(cBasicIntExprCst);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CINT_EXPR_VAR: {
				CIntExprVar cIntExprVar = (CIntExprVar)theEObject;
				T result = caseCIntExprVar(cIntExprVar);
				if (result == null) result = caseCIntExpr(cIntExprVar);
				if (result == null) result = caseCNode(cIntExprVar);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CBASIC_INT_EXPR_VAR: {
				CBasicIntExprVar cBasicIntExprVar = (CBasicIntExprVar)theEObject;
				T result = caseCBasicIntExprVar(cBasicIntExprVar);
				if (result == null) result = caseCIntExprVar(cBasicIntExprVar);
				if (result == null) result = caseCIntExpr(cBasicIntExprVar);
				if (result == null) result = caseCNode(cBasicIntExprVar);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CADD_VAR: {
				CAddVar cAddVar = (CAddVar)theEObject;
				T result = caseCAddVar(cAddVar);
				if (result == null) result = caseCBasicIntExprVar(cAddVar);
				if (result == null) result = caseCIntExprVar(cAddVar);
				if (result == null) result = caseCIntExpr(cAddVar);
				if (result == null) result = caseCNode(cAddVar);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CSUB_VAR: {
				CSubVar cSubVar = (CSubVar)theEObject;
				T result = caseCSubVar(cSubVar);
				if (result == null) result = caseCBasicIntExprVar(cSubVar);
				if (result == null) result = caseCIntExprVar(cSubVar);
				if (result == null) result = caseCIntExpr(cSubVar);
				if (result == null) result = caseCNode(cSubVar);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			case ExpressionPackage.CINT_VAR_REF: {
				CIntVarRef cIntVarRef = (CIntVarRef)theEObject;
				T result = caseCIntVarRef(cIntVarRef);
				if (result == null) result = caseCIntExprVar(cIntVarRef);
				if (result == null) result = caseCIntExpr(cIntVarRef);
				if (result == null) result = caseCNode(cIntVarRef);
				if (result == null) result = defaultCase(theEObject);
				return result;
			}
			default: return defaultCase(theEObject);
		}
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CInt Var</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CInt Var</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCIntVar(CIntVar object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CInt Expr</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CInt Expr</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCIntExpr(CIntExpr object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CInt Cst</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CInt Cst</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCIntCst(CIntCst object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CInt Expr Cst</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CInt Expr Cst</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCIntExprCst(CIntExprCst object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CAdd Cst</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CAdd Cst</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCAddCst(CAddCst object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CSub Cst</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CSub Cst</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCSubCst(CSubCst object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CMult Cst</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CMult Cst</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCMultCst(CMultCst object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CDiv Cst</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CDiv Cst</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCDivCst(CDivCst object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CBasic Int Expr Cst</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CBasic Int Expr Cst</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCBasicIntExprCst(CBasicIntExprCst object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CInt Expr Var</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CInt Expr Var</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCIntExprVar(CIntExprVar object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CBasic Int Expr Var</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CBasic Int Expr Var</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCBasicIntExprVar(CBasicIntExprVar object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CAdd Var</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CAdd Var</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCAddVar(CAddVar object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CSub Var</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CSub Var</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCSubVar(CSubVar object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CInt Var Ref</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CInt Var Ref</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCIntVarRef(CIntVarRef object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>CNode</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>CNode</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
	 * @generated
	 */
	public T caseCNode(CNode object) {
		return null;
	}

	/**
	 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * <!-- begin-user-doc -->
	 * This implementation returns null;
	 * returning a non-null result will terminate the switch, but this is the last case anyway.
	 * <!-- end-user-doc -->
	 * @param object the target of the switch.
	 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
	 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
	 * @generated
	 */
	public T defaultCase(EObject object) {
		return null;
	}

} //ExpressionSwitch
